import 'package:flutter/material.dart';

class BottomBar extends StatelessWidget {
  final int index;
  final void Function(int index) onItemPress;

  final _activeColor = Color.fromARGB(255, 55, 17, 254);
  final _inactiveColor = Colors.black;

  BottomBar({Key key, @required this.index, @required this.onItemPress})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 50,
      child: Row(
        children: [
          Expanded(
              child: Center(
            child: IconButton(
              icon: Icon(Icons.home_filled),
              color: index == 0 ? _activeColor : _inactiveColor,
              onPressed: () {
                onItemPress(0);
              },
            ),
          )),
          Expanded(
              child: Center(
            child: IconButton(
              icon: Icon(Icons.add_box_outlined),
              color: index == 1 ? _activeColor : _inactiveColor,
              onPressed: () {
                onItemPress(1);
              },
            ),
          )),
          Expanded(
              child: Center(
            child: IconButton(
              icon: Icon(Icons.settings),
              color: index == 2 ? _activeColor : _inactiveColor,
              onPressed: () {
                onItemPress(2);
              },
            ),
          )),
        ],
      ),
    );
  }
}
